package com.lsmo.android.carfans.activity.news;

import com.lsmo.android.carfans.model.news.News;

import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class NewsDetailActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		News news = NewsAdapter.getNewsFactory().get(
				String.valueOf(NewsAdapter.getIndex()));
		LinearLayout newsDetail = new LinearLayout(this);
		newsDetail.setOrientation(LinearLayout.VERTICAL);
		TextView title = new TextView(this);
		title.setText(news.getTitle());
		title.setGravity(Gravity.CENTER_HORIZONTAL);
		title.setTextSize(29);
		newsDetail.addView(title);
		TextView sum=new TextView(this);
		sum.setGravity(Gravity.CENTER_HORIZONTAL);
		sum.setTextSize(15);
		sum.setText(news.getSummary()+"模拟数据模拟数据模拟数据模拟数据模拟数据模拟数据模拟数据模拟数据模拟数据模拟数据模拟数据模拟数据");
		newsDetail.addView(sum);
		ImageView img=new ImageView(this);
		img.setImageResource(news.getImgId());
		img.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,40));
		newsDetail.addView(img);
		setContentView(newsDetail);
	}
}
